home *** CD-ROM | disk | FTP | other *** search
/ All for Cell Phones: Sony Ericsson / Sony-Ericsson 2004.iso / Java / Kool / Kool.jar / kool / Obstacle.class (.txt) < prev    next >
Encoding:
Java Class File  |  2001-12-24  |  1.5 KB  |  37 lines

  1. package kool;
  2.  
  3. import com.siemens.mp.game.Sprite;
  4.  
  5. public class Obstacle extends Sprite {
  6.    // $FF: renamed from: H int
  7.    public static final int field_0 = 1;
  8.    // $FF: renamed from: V int
  9.    public static final int field_1 = 2;
  10.    public int type;
  11.    public int[] rect;
  12.    private static byte[] wallh_bin = new byte[]{-1, -32, -86, -96, -1, -32};
  13.    private static byte[] wallh_mask = new byte[]{-1, -32, -1, -32, -1, -32};
  14.    private static byte[] wallv_bin = new byte[]{-32, -96, -32, -96, -32, -96, -32, -96, -32, -96, -32};
  15.    private static byte[] wallv_mask = new byte[]{-32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32};
  16.  
  17.    public Obstacle(int type) {
  18.       super(type == 1 ? wallh_bin : wallv_bin, 0, type == 1 ? 16 : 8, type == 1 ? 3 : 11, type == 1 ? wallh_mask : wallv_mask, 0, 1);
  19.       if (type == 1) {
  20.          this.setCollisionRectangle(0, 0, 11, 3);
  21.       } else {
  22.          this.setCollisionRectangle(0, 0, 3, 11);
  23.       }
  24.  
  25.       this.type = type;
  26.    }
  27.  
  28.    public void setCollisionRectangle(int x, int y, int dx, int dy) {
  29.       super.setCollisionRectangle(x, y, dx, dy);
  30.       this.rect = new int[]{x, y, dx, dy};
  31.    }
  32.  
  33.    public int[] getCollisionRectangle() {
  34.       return new int[]{((Sprite)this).getXPosition() + this.rect[0], ((Sprite)this).getYPosition() + this.rect[1], this.rect[2], this.rect[3]};
  35.    }
  36. }
  37.